package com.example.Laboratory.Controller;

import com.example.Laboratory.Entity.Suspended_frame;
import com.example.Laboratory.Service.Suspended_frameService;
import com.example.Laboratory.Untils.ResultCode;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.io.IOException;

@RestController
@Api(value = "Suspended_frame", description = "悬浮框")
@RequestMapping(value = "/suspended_frame")
@CrossOrigin
public class Suspended_frameController {

    @Autowired
    Suspended_frameService suspended_frameService;

    @ApiOperation(value = "添加悬浮框", notes = "添加悬浮框")
    @RequestMapping(value = "/addSuspended_frame", method = RequestMethod.POST, produces = "application/json;charset=utf-8")
    public Object addOpen_subject (Suspended_frame t) throws IOException {
        return ResultCode.SUCCESS.result(suspended_frameService.addSuspended_frame(t));
    }

    @ApiOperation(value = "删除悬浮框", notes = "删除悬浮框")
    @RequestMapping(value = "/deleteSuspended_frame", method = RequestMethod.GET, produces = "application/json;charset=utf-8")
    public Object deleteSuspended_frame (@RequestParam int suspended_frame_id) throws IOException {
        return ResultCode.SUCCESS.result(suspended_frameService.deleteSuspended_frame(suspended_frame_id));
    }

    @ApiOperation(value = "查找悬浮框", notes = "查找悬浮框")
    @RequestMapping(value = "/researchSuspended_frame", method = RequestMethod.POST, produces = "application/json;charset=utf-8")
    public Object selectSuspended_frame ( ) throws IOException {
        return ResultCode.SUCCESS.result(suspended_frameService.selectSuspended_frame());
    }

    @ApiOperation(value = "修改悬浮框", notes = "修改悬浮框")
    @RequestMapping(value = "/reviseSuspended_frame", method = RequestMethod.POST, produces = "application/json;charset=utf-8")
    public Object updateSuspended_frame (Suspended_frame i) throws IOException {
        return ResultCode.SUCCESS.result(suspended_frameService.updateSuspended_frame(i));
    }
}
